Stuff I did last night while watching TV
authorArturo Espinosa <unammx@src.gnome.org>
Tue, 5 Jan 1999 21:27:07 +0000 (21:27 +0000)
committerArturo Espinosa <unammx@src.gnome.org>
Tue, 5 Jan 1999 21:27:07 +0000 (21:27 +0000)
gdk-pixbuf/ChangeLog [new file with mode: 0644]
gdk-pixbuf/Makefile.am
gdk-pixbuf/gdk-pixbuf.h
gdk-pixbuf/io-png.c

diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
index 54b393887792bc32c534962727512d25e59bf561..acb7979975547f25ae8ced7f9e52cec4ea56589b 100644 (file)
@@ -1,7 +1,22 @@
 
-_SOURCES =     \
+lib_LTLIBRARIES =              \
+       libgdk-pixbuf.la        \
+       libpixbuf-png.la
+
+#
+# The GdkPixBuf library
+#
+libgdk_pixbufincludedir = $(includedir)/gdk-pixbuf
+
+libgdk_pixbuf_la_SOURCES =     \
        gdk-pixbuf.c            \
        gdk-pixbuf-io.c
-       
-_HEADERS =     \
+
+libgdk_pixbufinclude_HEADERS = \
        gdk-pixbuf.h
+
+#
+# The PNG plugin.
+#
+libpixbuf_png_la_SOURCES =     \
+       io-png.c
\ No newline at end of file
index 6c5e8f8fb64a5e0212008b58211d369b2eaf8415..02132d8d86ae350c19c3c91761c069d7f4eedc28 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _GDK_PIXBUF_H_
 #define _GDK_PIXBUF_H_
 
+#include <libart_lgpl/art_misc.h>
 #include <libart_lgpl/art_pixbuf.h>
 
 typedef struct {
index 18f661ce05aaa271327d7d83e428b5bd34b82dd9..414ef45e764dac69ea538c181b1f127510e0d988 100644 (file)
@@ -2,7 +2,6 @@
  * io-png.c: GdkPixBuf image loader for PNG files.
  *
  * Author:
- *    Rasterman (raster@redhat.com).
  *    Miguel de Icaza (miguel@gnu.org)
  *
  */
@@ -19,6 +18,8 @@ image_load (FILE *f);
        png_structp png;
        png_infop   info_ptr, end_info;
        int width, height, depth, color_type, interlace_type;
+       int have_alpha, number_passes;
+       art_u8 *data;
        
        g_return_val_if_fail (filename != NULL, NULL);
 
@@ -50,13 +51,40 @@ image_load (FILE *f);
 
        if (color_type == color_type == PNG_COLOR_TYPE_PALETTE)
                png_set_expand (png);
-       
+
+       /*
+        * Strip 16 bit information to 8 bit
+        */
        png_set_strip_16 (png);
+
+       /*
+        * Extract multiple pixels with bit depths 1, 2 and 4 from a single
+        * byte into separate bytes
+        */
        png_set_packing (png);
-       if (png_get_valid (png, info_ptr, PNG_INFO_tRNS))
-               png_set_expand (png);
 
+       /*
+        * Makes the PNG file to be rendered into RGB or RGBA
+        * modes (no matter of the bit depth nor the image
+        * mode
+        */
+       png_set_expand (png);
+
+       /*
+        * Simplify loading by always having 4 bytes
+        */
        png_set_filler (png, 0xff, PNG_FILLER_AFTER);
 
-       /* FIXME finish this */
+       if (color_type & PNG_COLOR_MASK_ALPHA)
+               have_alpha = 1
+       else
+               have_alpha = 0;
+       
+       data = art_alloc (width * height * (3 + have_alpha));
+       if (!data){
+               png_destroy_read_struct (&png, &info_ptr, &end_info);
+               return NULL;
+       }
+
+       number_passes = png_set_interlace_handling (png);
 }